class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: D = None
        self.v: A = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.txt = txt

l = A("l")
c = B("c")
h = C("h")
b = D("b")
e = B("e")
f = C("f")
a = A("a")
m = A("m")

l.x = h
l.y = e
c.y = h
c.u = e
c.q = e
h.s = b
h.r = b
h.x = b
h.v = l
b.u = f
b.z = f
e.y = h
e.u = c
e.q = c
f.s = b
f.r = b
f.x = b
f.v = l
a.x = f
a.y = e
m.x = f
m.y = c
assert c.y.s.u.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: D = None
        self.v: A = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.txt = txt

l = A("l")
c = B("c")
h = C("h")
b = D("b")
e = B("e")
f = C("f")
a = A("a")
m = A("m")

l.x = h
l.y = e
c.y = h
c.u = e
c.q = e
h.s = b
h.r = b
h.x = b
h.v = l
b.u = f
b.z = f
e.y = h
e.u = c
e.q = c
f.s = b
f.r = b
f.x = b
f.v = l
a.x = f
a.y = e
m.x = f
m.y = c
assert c.y.s.u.v.y.y.txt == "h"