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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: F = None
        self.r: A = None
        self.t: A = None
        self.o: E = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

a = A("a")
f = B("f")
h = C("h")
i = D("i")
l = E("l")
b = F("b")

a.x = h
a.p = l
f.x = h
f.z = h
f.r = a
f.o = l
h.q = f
h.x = l
i.v = h
i.s = b
i.r = a
i.t = a
i.u = a
i.o = l
l.t = f
b.o = l
assert b.o.t.r.p.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: F = None
        self.r: A = None
        self.t: A = None
        self.o: E = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

a = A("a")
f = B("f")
h = C("h")
i = D("i")
l = E("l")
b = F("b")

a.x = h
a.p = l
f.x = h
f.z = h
f.r = a
f.o = l
h.q = f
h.x = l
i.v = h
i.s = b
i.r = a
i.t = a
i.u = a
i.o = l
l.t = f
b.o = l
assert b.o.t.r.p.t.z.txt == "h"