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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.u: C = None
        self.v: D = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

m = A("m")
j = B("j")
e = C("e")
b = D("b")
l = E("l")
g = F("g")

m.y = e
m.r = e
m.u = l
m.q = b
j.t = e
j.x = l
e.y = m
e.r = m
e.v = m
e.z = g
e.o = g
e.p = j
b.s = e
l.p = m
g.q = e
g.u = e
g.z = j
g.v = b
g.r = b
g.o = b
assert l.p.u.p.r.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: E = None
        self.q: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.u: C = None
        self.v: D = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

m = A("m")
j = B("j")
e = C("e")
b = D("b")
l = E("l")
g = F("g")

m.y = e
m.r = e
m.u = l
m.q = b
j.t = e
j.x = l
e.y = m
e.r = m
e.v = m
e.z = g
e.o = g
e.p = j
b.s = e
l.p = m
g.q = e
g.u = e
g.z = j
g.v = b
g.r = b
g.o = b
assert l.p.u.p.r.r.q.txt == "b"