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

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

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

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

i = A("i")
m = B("m")
l = C("l")
f = D("f")
b = D("b")
g = A("g")
h = B("h")
c = C("c")
e = C("e")

i.x = h
i.s = m
m.z = h
m.s = h
l.y = h
l.p = h
l.s = c
l.x = e
f.y = b
b.y = f
g.x = h
g.s = m
h.z = m
h.s = m
c.y = m
c.p = h
c.s = l
c.x = e
e.y = m
e.p = h
e.s = l
e.x = l
assert f.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: B = None
        self.txt = txt

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

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

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

i = A("i")
m = B("m")
l = C("l")
f = D("f")
b = D("b")
g = A("g")
h = B("h")
c = C("c")
e = C("e")

i.x = h
i.s = m
m.z = h
m.s = h
l.y = h
l.p = h
l.s = c
l.x = e
f.y = b
b.y = f
g.x = h
g.s = m
h.z = m
h.s = m
c.y = m
c.p = h
c.s = l
c.x = e
e.y = m
e.p = h
e.s = l
e.x = l
assert f.y.y.y.txt == "b"