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

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

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

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

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

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

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

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

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

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

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