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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.v: A = None
        self.u: E = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.v: A = None
        self.u: E = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

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