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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.s: A = None
        self.y: E = None
        self.z: C = None
        self.txt = txt

i = A("i")
g = B("g")
b = C("b")
l = D("l")
c = E("c")
d = F("d")

i.q = g
i.p = l
i.r = c
g.z = b
g.r = l
g.p = i
g.y = i
g.t = c
b.t = d
b.u = d
b.y = c
b.q = l
b.p = i
l.t = d
l.r = i
l.o = i
c.v = i
d.q = i
d.s = i
d.v = b
d.z = b
d.y = c
assert l.t.v.t.y.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: D = None
        self.r: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.s: A = None
        self.y: E = None
        self.z: C = None
        self.txt = txt

i = A("i")
g = B("g")
b = C("b")
l = D("l")
c = E("c")
d = F("d")

i.q = g
i.p = l
i.r = c
g.z = b
g.r = l
g.p = i
g.y = i
g.t = c
b.t = d
b.u = d
b.y = c
b.q = l
b.p = i
l.t = d
l.r = i
l.o = i
c.v = i
d.q = i
d.s = i
d.v = b
d.z = b
d.y = c
assert l.t.v.t.y.v.p.txt == "l"