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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

d = A("d")
j = B("j")
m = C("m")
a = D("a")
f = E("f")
b = F("b")

d.r = f
d.o = f
d.u = b
d.q = m
d.z = m
j.x = a
j.o = a
m.v = d
a.p = j
f.p = b
b.y = d
b.v = d
b.t = j
b.o = m
assert a.p.x.p.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: F = None
        self.q: C = None
        self.o: E = None
        self.z: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

d = A("d")
j = B("j")
m = C("m")
a = D("a")
f = E("f")
b = F("b")

d.r = f
d.o = f
d.u = b
d.q = m
d.z = m
j.x = a
j.o = a
m.v = d
a.p = j
f.p = b
b.y = d
b.v = d
b.t = j
b.o = m
assert a.p.x.p.o.p.txt == "j"