class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

h.x = k
h.s = c
h.v = i
i.v = k
i.p = c
k.o = i
m.q = i
e.u = c
e.s = b
e.t = b
e.x = h
b.z = k
b.q = h
l.u = i
l.s = b
l.t = a
l.x = h
a.z = k
a.q = h
c.v = k
c.p = i
assert c.v.o.p.v.o.p.p.v.o.txt == "i"