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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: D = None
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.t: A = None
        self.s: E = None
        self.w: E = None
        self.r: E = None
        self.txt = txt

j = A("j")
c = B("c")
g = C("g")
e = D("e")
k = E("k")
f = F("f")

j.r = k
j.t = e
c.q = e
g.u = j
g.w = j
g.o = j
g.t = c
g.s = e
e.t = c
k.r = f
k.u = f
k.v = e
f.y = k
f.s = k
f.w = k
f.r = k
f.p = e
f.t = j
assert c.q.t.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: D = None
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.t: A = None
        self.s: E = None
        self.w: E = None
        self.r: E = None
        self.txt = txt

j = A("j")
c = B("c")
g = C("g")
e = D("e")
k = E("k")
f = F("f")

j.r = k
j.t = e
c.q = e
g.u = j
g.w = j
g.o = j
g.t = c
g.s = e
e.t = c
k.r = f
k.u = f
k.v = e
f.y = k
f.s = k
f.w = k
f.r = k
f.p = e
f.t = j
assert c.q.t.q.t.txt == "c"