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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: E = None
        self.x: F = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

a.t = b
a.o = e
b.q = j
b.t = j
b.x = d
b.v = e
e.w = f
f.x = a
f.s = b
f.r = j
j.o = b
j.s = f
j.z = a
j.q = d
d.p = b
d.r = b
d.y = f
assert e.w.x.t.v.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: E = None
        self.x: F = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

a.t = b
a.o = e
b.q = j
b.t = j
b.x = d
b.v = e
e.w = f
f.x = a
f.s = b
f.r = j
j.o = b
j.s = f
j.z = a
j.q = d
d.p = b
d.r = b
d.y = f
assert e.w.x.t.v.w.x.txt == "a"