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

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

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

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

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

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

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

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

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

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

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

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

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

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

i.p = k
c.p = d
c.o = l
d.y = h
e.s = k
a.p = e
a.r = h
a.q = d
l.s = b
l.t = d
l.y = k
l.z = h
b.s = l
b.t = d
b.y = k
b.z = c
h.p = d
h.o = l
k.s = e
m.p = k
assert d.y.o.y.s.s.txt == "k"