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

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

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

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

j = A("j")
c = B("c")
l = C("l")
a = D("a")
h = A("h")
n = A("n")
f = C("f")
i = D("i")

j.p = a
j.x = f
c.o = i
c.t = h
c.w = h
l.t = c
l.r = f
a.z = l
a.v = l
a.p = j
a.u = i
h.p = i
h.x = l
n.p = a
n.x = f
f.t = c
f.r = l
i.z = l
i.v = l
i.p = j
i.u = a
assert h.p.v.r.r.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: C = None
        self.txt = txt

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

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

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

j = A("j")
c = B("c")
l = C("l")
a = D("a")
h = A("h")
n = A("n")
f = C("f")
i = D("i")

j.p = a
j.x = f
c.o = i
c.t = h
c.w = h
l.t = c
l.r = f
a.z = l
a.v = l
a.p = j
a.u = i
h.p = i
h.x = l
n.p = a
n.x = f
f.t = c
f.r = l
i.z = l
i.v = l
i.p = j
i.u = a
assert h.p.v.r.r.r.t.w.txt == "h"