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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: E = None
        self.o: D = None
        self.v: E = None
        self.z: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.x: E = None
        self.s: E = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

e = A("e")
n = B("n")
c = C("c")
l = D("l")
f = E("f")
b = F("b")

e.x = f
e.u = b
n.q = c
n.o = f
c.x = l
c.o = l
c.y = f
c.v = f
c.z = b
l.q = n
l.o = n
l.x = f
l.s = f
l.r = f
f.z = l
b.s = l
b.z = l
assert b.s.r.z.q.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: E = None
        self.o: D = None
        self.v: E = None
        self.z: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.x: E = None
        self.s: E = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

e = A("e")
n = B("n")
c = C("c")
l = D("l")
f = E("f")
b = F("b")

e.x = f
e.u = b
n.q = c
n.o = f
c.x = l
c.o = l
c.y = f
c.v = f
c.z = b
l.q = n
l.o = n
l.x = f
l.s = f
l.r = f
f.z = l
b.s = l
b.z = l
assert b.s.r.z.q.q.z.txt == "b"