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

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

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

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

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

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

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

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

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

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

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