class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: E = None
        self.z: E = None
        self.s: E = None
        self.q: C = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
a = C("a")
m = D("m")
n = E("n")
c = F("c")
e = E("e")

f.u = e
f.z = e
f.s = e
f.r = e
f.o = n
f.q = a
d.w = m
d.p = e
d.x = f
d.z = a
a.r = c
a.o = f
m.w = e
n.r = c
n.u = c
c.v = f
c.p = a
e.r = c
e.u = c
assert n.r.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: E = None
        self.z: E = None
        self.s: E = None
        self.q: C = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
a = C("a")
m = D("m")
n = E("n")
c = F("c")
e = E("e")

f.u = e
f.z = e
f.s = e
f.r = e
f.o = n
f.q = a
d.w = m
d.p = e
d.x = f
d.z = a
a.r = c
a.o = f
m.w = e
n.r = c
n.u = c
c.v = f
c.p = a
e.r = c
e.u = c
assert n.r.p.r.txt == "c"