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

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

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

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

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

f.w = g
c.x = g
h.u = m
h.p = f
m.s = f
m.x = f
m.t = f
m.w = g
g.s = f
g.x = f
g.t = f
g.w = m
a.x = g
j.x = m
l.u = m
l.p = f
e.u = g
e.p = f
assert f.w.w.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

f.w = g
c.x = g
h.u = m
h.p = f
m.s = f
m.x = f
m.t = f
m.w = g
g.s = f
g.x = f
g.t = f
g.w = m
a.x = g
j.x = m
l.u = m
l.p = f
e.u = g
e.p = f
assert f.w.w.w.t.txt == "f"