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

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

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

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

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

e.t = b
e.p = c
a.y = c
a.x = e
h.r = a
h.u = k
h.z = k
n.u = i
n.x = d
b.y = c
b.x = e
f.u = b
f.x = d
k.u = b
k.x = d
i.y = c
i.x = c
c.t = i
c.p = e
d.r = b
d.u = f
d.z = n
assert a.y.t.y.p.t.x.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: A = None
        self.txt = txt

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

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

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

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

e.t = b
e.p = c
a.y = c
a.x = e
h.r = a
h.u = k
h.z = k
n.u = i
n.x = d
b.y = c
b.x = e
f.u = b
f.x = d
k.u = b
k.x = d
i.y = c
i.x = c
c.t = i
c.p = e
d.r = b
d.u = f
d.z = n
assert a.y.t.y.p.t.x.t.y.txt == "c"