class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: D = None
        self.v: D = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
h = C("h")
f = D("f")
m = B("m")
c = C("c")

j.u = f
j.r = f
j.v = f
g.u = h
g.t = h
g.y = m
h.t = m
f.y = m
f.p = m
m.u = h
m.t = h
m.y = g
c.t = m
assert g.y.y.y.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: D = None
        self.v: D = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
h = C("h")
f = D("f")
m = B("m")
c = C("c")

j.u = f
j.r = f
j.v = f
g.u = h
g.t = h
g.y = m
h.t = m
f.y = m
f.p = m
m.u = h
m.t = h
m.y = g
c.t = m
assert g.y.y.y.y.t.txt == "h"