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

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

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

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

g = A("g")
l = B("l")
f = C("f")
c = D("c")
d = B("d")
e = B("e")
j = A("j")
a = A("a")
b = D("b")
i = D("i")

g.u = l
g.w = l
l.y = i
l.r = f
f.x = a
f.p = l
c.z = f
c.s = d
c.q = a
d.y = c
d.r = f
e.y = c
e.r = f
j.u = e
j.w = l
a.u = e
a.w = l
b.z = f
b.s = l
b.q = a
i.z = f
i.s = e
i.q = g
assert b.z.x.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.txt = txt

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

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

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

g = A("g")
l = B("l")
f = C("f")
c = D("c")
d = B("d")
e = B("e")
j = A("j")
a = A("a")
b = D("b")
i = D("i")

g.u = l
g.w = l
l.y = i
l.r = f
f.x = a
f.p = l
c.z = f
c.s = d
c.q = a
d.y = c
d.r = f
e.y = c
e.r = f
j.u = e
j.w = l
a.u = e
a.w = l
b.z = f
b.s = l
b.q = a
i.z = f
i.s = e
i.q = g
assert b.z.x.u.y.txt == "c"