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

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

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

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

c = A("c")
j = B("j")
b = C("b")
i = D("i")
h = B("h")
k = D("k")
d = C("d")
g = A("g")

c.p = g
c.u = i
c.r = i
j.r = h
j.t = g
j.w = k
b.p = d
b.z = d
b.x = i
b.s = h
i.s = h
i.p = c
h.r = j
h.t = c
h.w = i
k.s = j
k.p = g
d.p = b
d.z = b
d.x = k
d.s = j
g.p = c
g.u = k
g.r = i
assert c.u.s.r.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: D = None
        self.r: D = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
b = C("b")
i = D("i")
h = B("h")
k = D("k")
d = C("d")
g = A("g")

c.p = g
c.u = i
c.r = i
j.r = h
j.t = g
j.w = k
b.p = d
b.z = d
b.x = i
b.s = h
i.s = h
i.p = c
h.r = j
h.t = c
h.w = i
k.s = j
k.p = g
d.p = b
d.z = b
d.x = k
d.s = j
g.p = c
g.u = k
g.r = i
assert c.u.s.r.r.t.txt == "c"