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

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

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

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

g = A("g")
m = B("m")
i = C("i")
n = D("n")
b = A("b")
a = C("a")
k = A("k")
f = D("f")
h = D("h")
e = B("e")

g.t = b
g.u = f
g.v = k
g.p = i
m.t = f
i.r = a
i.y = a
i.w = g
i.u = m
n.x = a
n.r = g
n.p = k
b.t = k
b.v = k
b.u = f
b.p = i
a.r = i
a.y = i
a.w = g
a.u = m
k.t = b
k.u = f
k.v = g
k.p = i
f.x = i
f.r = b
f.p = k
h.x = a
h.r = b
h.p = g
e.t = h
assert k.t.t.v.v.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: D = None
        self.v: A = None
        self.p: C = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
i = C("i")
n = D("n")
b = A("b")
a = C("a")
k = A("k")
f = D("f")
h = D("h")
e = B("e")

g.t = b
g.u = f
g.v = k
g.p = i
m.t = f
i.r = a
i.y = a
i.w = g
i.u = m
n.x = a
n.r = g
n.p = k
b.t = k
b.v = k
b.u = f
b.p = i
a.r = i
a.y = i
a.w = g
a.u = m
k.t = b
k.u = f
k.v = g
k.p = i
f.x = i
f.r = b
f.p = k
h.x = a
h.r = b
h.p = g
e.t = h
assert k.t.t.v.v.u.p.txt == "k"