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

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

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

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

c = A("c")
l = B("l")
b = C("b")
g = D("g")
f = B("f")
i = C("i")
j = A("j")
n = D("n")

c.w = i
c.u = n
c.t = n
c.p = f
l.p = b
b.y = i
b.r = l
g.w = j
f.p = i
i.y = b
i.r = l
j.w = i
j.u = n
j.p = l
j.t = g
n.w = j
assert g.w.w.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: D = None
        self.p: B = None
        self.t: D = None
        self.txt = txt

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

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

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

c = A("c")
l = B("l")
b = C("b")
g = D("g")
f = B("f")
i = C("i")
j = A("j")
n = D("n")

c.w = i
c.u = n
c.t = n
c.p = f
l.p = b
b.y = i
b.r = l
g.w = j
f.p = i
i.y = b
i.r = l
j.w = i
j.u = n
j.p = l
j.t = g
n.w = j
assert g.w.w.r.p.txt == "b"