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

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

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

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

a = A("a")
n = B("n")
b = C("b")
d = D("d")
g = B("g")
e = C("e")
h = B("h")
c = A("c")
i = C("i")
l = C("l")

a.y = d
a.z = n
a.t = b
n.y = i
n.t = c
n.p = e
b.z = d
b.v = d
d.u = c
d.y = g
d.q = b
g.y = e
g.t = c
g.p = l
e.z = d
e.v = d
h.y = l
h.p = l
h.t = a
c.y = d
c.z = g
c.t = i
i.z = d
i.v = d
l.z = d
l.v = d
assert e.z.u.t.v.u.y.u.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.t: C = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
b = C("b")
d = D("d")
g = B("g")
e = C("e")
h = B("h")
c = A("c")
i = C("i")
l = C("l")

a.y = d
a.z = n
a.t = b
n.y = i
n.t = c
n.p = e
b.z = d
b.v = d
d.u = c
d.y = g
d.q = b
g.y = e
g.t = c
g.p = l
e.z = d
e.v = d
h.y = l
h.p = l
h.t = a
c.y = d
c.z = g
c.t = i
i.z = d
i.v = d
l.z = d
l.v = d
assert e.z.u.t.v.u.y.u.y.y.txt == "g"