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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: C = None
        self.r: E = None
        self.p: C = None
        self.o: B = None
        self.q: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

b.u = k
g.p = c
c.t = g
m.u = g
m.o = g
m.x = c
m.p = c
m.r = f
m.q = k
d.o = n
d.u = m
d.s = c
k.s = n
n.o = d
n.u = m
n.s = c
f.o = n
f.u = m
f.s = c
assert f.u.x.t.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: C = None
        self.r: E = None
        self.p: C = None
        self.o: B = None
        self.q: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

b.u = k
g.p = c
c.t = g
m.u = g
m.o = g
m.x = c
m.p = c
m.r = f
m.q = k
d.o = n
d.u = m
d.s = c
k.s = n
n.o = d
n.u = m
n.s = c
f.o = n
f.u = m
f.s = c
assert f.u.x.t.p.t.p.txt == "c"