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

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: F = None
        self.y: D = None
        self.q: F = None
        self.txt = txt

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

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

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

l.o = c
k.p = i
h.z = a
h.x = l
c.r = b
c.w = b
c.q = b
c.y = g
a.s = d
a.p = l
b.x = c
b.q = c
b.v = c
b.p = l
b.z = l
b.y = h
d.s = a
d.p = l
g.r = b
g.w = b
g.q = b
g.y = c
i.z = d
i.x = l
assert a.s.s.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: F = None
        self.y: D = None
        self.q: F = None
        self.txt = txt

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

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

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

l.o = c
k.p = i
h.z = a
h.x = l
c.r = b
c.w = b
c.q = b
c.y = g
a.s = d
a.p = l
b.x = c
b.q = c
b.v = c
b.p = l
b.z = l
b.y = h
d.s = a
d.p = l
g.r = b
g.w = b
g.q = b
g.y = c
i.z = d
i.x = l
assert a.s.s.p.o.txt == "c"