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

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

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

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

i = A("i")
n = B("n")
g = C("g")
f = D("f")
j = B("j")
d = B("d")
m = A("m")
b = A("b")
l = D("l")

i.p = n
n.x = j
n.u = g
n.t = g
g.t = j
g.y = l
f.p = d
f.r = l
f.q = l
f.w = i
j.x = d
j.u = g
j.t = g
d.x = n
d.u = g
d.t = g
m.p = d
b.p = n
l.p = d
l.r = f
l.q = f
l.w = i
assert g.t.u.y.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

i = A("i")
n = B("n")
g = C("g")
f = D("f")
j = B("j")
d = B("d")
m = A("m")
b = A("b")
l = D("l")

i.p = n
n.x = j
n.u = g
n.t = g
g.t = j
g.y = l
f.p = d
f.r = l
f.q = l
f.w = i
j.x = d
j.u = g
j.t = g
d.x = n
d.u = g
d.t = g
m.p = d
b.p = n
l.p = d
l.r = f
l.q = f
l.w = i
assert g.t.u.y.q.w.txt == "i"