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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = 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.r: F = None
        self.t: A = None
        self.y: D = None
        self.p: D = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

l = A("l")
f = B("f")
j = C("j")
k = D("k")
c = E("c")
b = F("b")

l.q = c
l.p = k
l.x = k
f.x = j
f.z = k
f.p = l
j.o = b
k.v = l
c.r = b
c.t = l
c.y = k
c.p = k
c.x = k
b.p = f
assert l.p.v.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = 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.r: F = None
        self.t: A = None
        self.y: D = None
        self.p: D = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

l = A("l")
f = B("f")
j = C("j")
k = D("k")
c = E("c")
b = F("b")

l.q = c
l.p = k
l.x = k
f.x = j
f.z = k
f.p = l
j.o = b
k.v = l
c.r = b
c.t = l
c.y = k
c.p = k
c.x = k
b.p = f
assert l.p.v.q.r.txt == "b"