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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: C = None
        self.y: D = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: B = None
        self.v: D = None
        self.u: E = None
        self.txt = txt

a = A("a")
c = B("c")
f = C("f")
k = D("k")
d = E("d")
n = F("n")
m = B("m")
g = C("g")
b = B("b")
i = B("i")

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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: C = None
        self.y: D = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: B = None
        self.v: D = None
        self.u: E = None
        self.txt = txt

a = A("a")
c = B("c")
f = C("f")
k = D("k")
d = E("d")
n = F("n")
m = B("m")
g = C("g")
b = B("b")
i = B("i")

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