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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: C = None
        self.txt = txt

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

d = A("d")
a = B("a")
k = C("k")
h = D("h")
n = C("n")
g = A("g")
e = B("e")
c = D("c")

d.y = h
d.t = g
d.p = c
d.q = n
a.u = e
a.y = g
k.s = e
k.o = n
h.t = c
h.w = c
h.r = c
h.y = d
n.s = a
n.o = k
g.y = c
g.p = c
g.t = d
g.q = k
e.u = a
e.y = d
c.t = h
c.w = h
c.r = h
c.y = d
assert e.y.q.s.u.u.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: A = None
        self.p: D = None
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: C = None
        self.txt = txt

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

d = A("d")
a = B("a")
k = C("k")
h = D("h")
n = C("n")
g = A("g")
e = B("e")
c = D("c")

d.y = h
d.t = g
d.p = c
d.q = n
a.u = e
a.y = g
k.s = e
k.o = n
h.t = c
h.w = c
h.r = c
h.y = d
n.s = a
n.o = k
g.y = c
g.p = c
g.t = d
g.q = k
e.u = a
e.y = d
c.t = h
c.w = h
c.r = h
c.y = d
assert e.y.q.s.u.u.u.y.txt == "d"