class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: B = None
        self.p: B = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
k = C("k")
e = D("e")
h = D("h")
i = D("i")
f = B("f")

l.t = b
l.z = b
l.p = f
b.x = f
b.p = f
b.t = l
k.o = h
k.q = l
e.p = b
e.y = h
e.w = l
e.o = l
h.p = b
h.y = i
h.w = l
h.o = l
i.p = b
i.y = e
i.w = l
i.o = l
f.x = b
f.p = b
f.t = l
assert i.y.y.y.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: B = None
        self.p: B = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
k = C("k")
e = D("e")
h = D("h")
i = D("i")
f = B("f")

l.t = b
l.z = b
l.p = f
b.x = f
b.p = f
b.t = l
k.o = h
k.q = l
e.p = b
e.y = h
e.w = l
e.o = l
h.p = b
h.y = i
h.w = l
h.o = l
i.p = b
i.y = e
i.w = l
i.o = l
f.x = b
f.p = b
f.t = l
assert i.y.y.y.o.p.txt == "f"