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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: A = None
        self.u: A = None
        self.s: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: D = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: A = None
        self.q: A = None
        self.p: A = None
        self.txt = txt

h = A("h")
f = B("f")
l = C("l")
e = D("e")
c = D("c")
j = D("j")
i = B("i")
b = A("b")

h.x = l
h.y = i
h.p = b
h.z = b
f.w = l
f.r = h
f.u = b
f.s = j
l.w = c
l.q = j
l.z = f
l.r = f
e.r = b
e.t = b
e.q = b
e.p = h
c.r = h
c.t = b
c.q = b
c.p = b
j.r = b
j.q = b
j.t = h
j.p = h
i.w = l
i.r = b
i.u = b
i.s = e
b.x = l
b.y = i
b.p = h
b.z = h
assert l.q.p.y.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.p: A = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: A = None
        self.u: A = None
        self.s: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: D = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: A = None
        self.q: A = None
        self.p: A = None
        self.txt = txt

h = A("h")
f = B("f")
l = C("l")
e = D("e")
c = D("c")
j = D("j")
i = B("i")
b = A("b")

h.x = l
h.y = i
h.p = b
h.z = b
f.w = l
f.r = h
f.u = b
f.s = j
l.w = c
l.q = j
l.z = f
l.r = f
e.r = b
e.t = b
e.q = b
e.p = h
c.r = h
c.t = b
c.q = b
c.p = b
j.r = b
j.q = b
j.t = h
j.p = h
i.w = l
i.r = b
i.u = b
i.s = e
b.x = l
b.y = i
b.p = h
b.z = h
assert l.q.p.y.r.x.txt == "l"