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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: A = None
        self.y: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: D = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

m.o = g
f.r = n
f.y = n
f.q = m
i.r = n
i.t = m
h.s = i
h.p = b
h.t = b
h.q = g
e.r = f
e.t = m
b.s = i
b.p = h
b.t = h
b.q = g
g.s = i
g.p = b
g.t = b
g.q = b
n.r = f
n.y = f
n.q = m
assert b.p.s.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: A = None
        self.y: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: D = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

m.o = g
f.r = n
f.y = n
f.q = m
i.r = n
i.t = m
h.s = i
h.p = b
h.t = b
h.q = g
e.r = f
e.t = m
b.s = i
b.p = h
b.t = h
b.q = g
g.s = i
g.p = b
g.t = b
g.q = b
n.r = f
n.y = f
n.q = m
assert b.p.s.t.o.txt == "g"