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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: E = None
        self.z: D = None
        self.x: E = None
        self.r: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

f.o = a
f.q = d
a.t = d
a.v = d
a.x = d
a.z = l
a.r = f
b.z = f
b.v = l
l.p = e
l.o = d
d.z = f
d.p = a
e.v = a
m.v = a
assert e.v.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: E = None
        self.z: D = None
        self.x: E = None
        self.r: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

f.o = a
f.q = d
a.t = d
a.v = d
a.x = d
a.z = l
a.r = f
b.z = f
b.v = l
l.p = e
l.o = d
d.z = f
d.p = a
e.v = a
m.v = a
assert e.v.v.p.txt == "a"