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

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

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

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

g = A("g")
a = B("a")
b = C("b")
e = D("e")
m = C("m")
n = C("n")
l = B("l")
d = C("d")

g.t = e
g.r = n
g.w = n
a.y = e
a.r = e
b.o = l
b.r = g
b.t = e
e.u = g
e.s = g
e.y = a
e.z = a
m.o = l
m.r = g
m.t = e
n.o = a
n.r = g
n.t = e
l.y = e
l.r = e
d.o = l
d.r = g
d.t = e
assert a.r.y.r.y.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.w: C = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
b = C("b")
e = D("e")
m = C("m")
n = C("n")
l = B("l")
d = C("d")

g.t = e
g.r = n
g.w = n
a.y = e
a.r = e
b.o = l
b.r = g
b.t = e
e.u = g
e.s = g
e.y = a
e.z = a
m.o = l
m.r = g
m.t = e
n.o = a
n.r = g
n.t = e
l.y = e
l.r = e
d.o = l
d.r = g
d.t = e
assert a.r.y.r.y.r.u.r.txt == "n"