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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
j = C("j")
g = D("g")
k = E("k")
c = F("c")

b.t = j
b.v = j
b.p = n
b.o = c
b.w = k
b.u = k
n.r = j
j.s = k
g.v = b
k.s = b
k.u = j
k.p = j
k.q = g
k.w = g
c.w = n
c.t = j
assert j.s.s.w.s.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.v: C = None
        self.o: F = None
        self.w: E = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
j = C("j")
g = D("g")
k = E("k")
c = F("c")

b.t = j
b.v = j
b.p = n
b.o = c
b.w = k
b.u = k
n.r = j
j.s = k
g.v = b
k.s = b
k.u = j
k.p = j
k.q = g
k.w = g
c.w = n
c.t = j
assert j.s.s.w.s.p.r.txt == "j"