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

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

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

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

h = A("h")
n = B("n")
b = C("b")
f = D("f")
e = D("e")
l = A("l")
g = C("g")
c = B("c")
j = A("j")

h.w = g
n.u = g
n.z = g
n.x = c
b.u = n
b.x = g
f.q = b
f.u = g
f.s = h
e.q = b
e.u = g
e.s = h
l.w = g
g.u = n
g.x = b
c.u = b
c.z = g
c.x = n
j.w = b
assert b.x.u.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

h = A("h")
n = B("n")
b = C("b")
f = D("f")
e = D("e")
l = A("l")
g = C("g")
c = B("c")
j = A("j")

h.w = g
n.u = g
n.z = g
n.x = c
b.u = n
b.x = g
f.q = b
f.u = g
f.s = h
e.q = b
e.u = g
e.s = h
l.w = g
g.u = n
g.x = b
c.u = b
c.z = g
c.x = n
j.w = b
assert b.x.u.u.x.txt == "b"