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

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

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

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

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

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

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

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

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

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

n.t = k
n.v = g
n.r = b
n.p = a
h.v = a
k.w = a
k.y = h
g.w = k
a.v = h
b.w = k
f.w = k
assert n.t.y.v.v.v.v.txt == "h"