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

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

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

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

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

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

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

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

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

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

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

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

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

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

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