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

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.y: A = None
        self.t: C = None
        self.txt = txt

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

f = A("f")
b = B("b")
h = C("h")
g = D("g")
k = A("k")
d = A("d")
j = C("j")
e = B("e")

f.r = d
f.x = e
f.y = h
f.t = j
b.r = e
b.u = h
h.q = j
h.t = j
h.p = f
h.y = d
g.w = f
k.r = f
k.x = b
k.y = j
k.t = j
d.r = k
d.x = b
d.y = h
d.t = h
j.q = h
j.t = h
j.p = f
j.y = f
e.r = b
e.u = h
assert g.w.y.p.x.u.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: B = None
        self.y: C = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.y: A = None
        self.t: C = None
        self.txt = txt

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

f = A("f")
b = B("b")
h = C("h")
g = D("g")
k = A("k")
d = A("d")
j = C("j")
e = B("e")

f.r = d
f.x = e
f.y = h
f.t = j
b.r = e
b.u = h
h.q = j
h.t = j
h.p = f
h.y = d
g.w = f
k.r = f
k.x = b
k.y = j
k.t = j
d.r = k
d.x = b
d.y = h
d.t = h
j.q = h
j.t = h
j.p = f
j.y = f
e.r = b
e.u = h
assert g.w.y.p.x.u.y.t.txt == "h"