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

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

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

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

h = A("h")
b = B("b")
m = C("m")
e = D("e")
c = B("c")

h.t = b
h.o = m
b.y = c
b.w = c
m.s = b
m.v = b
e.u = c
c.y = b
c.w = b
assert m.v.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

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

h = A("h")
b = B("b")
m = C("m")
e = D("e")
c = B("c")

h.t = b
h.o = m
b.y = c
b.w = c
m.s = b
m.v = b
e.u = c
c.y = b
c.w = b
assert m.v.y.w.y.txt == "c"