class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: F = None
        self.s: C = None
        self.o: F = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

l = A("l")
a = B("a")
c = C("c")
i = D("i")
e = E("e")
j = F("j")
b = A("b")
k = F("k")

l.p = a
l.q = k
l.s = c
l.o = j
l.x = b
a.o = k
c.p = a
c.q = e
c.w = i
i.u = c
e.w = k
e.r = b
j.z = l
j.x = e
b.p = a
b.q = j
b.o = j
b.s = c
b.x = l
k.z = l
k.x = e
assert j.z.x.s.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: F = None
        self.s: C = None
        self.o: F = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

l = A("l")
a = B("a")
c = C("c")
i = D("i")
e = E("e")
j = F("j")
b = A("b")
k = F("k")

l.p = a
l.q = k
l.s = c
l.o = j
l.x = b
a.o = k
c.p = a
c.q = e
c.w = i
i.u = c
e.w = k
e.r = b
j.z = l
j.x = e
b.p = a
b.q = j
b.o = j
b.s = c
b.x = l
k.z = l
k.x = e
assert j.z.x.s.p.o.txt == "k"