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

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

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

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

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

c.o = l
c.u = n
c.t = d
j.w = k
j.s = g
j.t = g
g.x = f
g.r = k
k.z = g
f.w = k
f.s = g
f.t = g
n.o = b
n.u = l
n.t = k
d.z = g
l.o = b
l.u = e
l.t = k
b.o = e
b.u = n
b.t = k
e.o = n
e.u = c
e.t = d
assert d.z.x.w.z.r.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.t: D = None
        self.txt = txt

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

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

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

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

c.o = l
c.u = n
c.t = d
j.w = k
j.s = g
j.t = g
g.x = f
g.r = k
k.z = g
f.w = k
f.s = g
f.t = g
n.o = b
n.u = l
n.t = k
d.z = g
l.o = b
l.u = e
l.t = k
b.o = e
b.u = n
b.t = k
e.o = n
e.u = c
e.t = d
assert d.z.x.w.z.r.z.x.txt == "f"