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

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

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

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

a = A("a")
e = B("e")
g = C("g")
l = D("l")
b = A("b")
n = B("n")
f = C("f")
i = B("i")

a.y = b
a.r = b
e.v = l
e.t = a
g.t = f
g.w = f
g.y = f
l.s = i
l.z = f
b.y = a
b.r = a
n.v = l
n.t = b
f.t = g
f.w = g
f.y = g
i.v = l
i.t = a
assert n.t.r.r.y.r.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: A = None
        self.txt = txt

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

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

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

a = A("a")
e = B("e")
g = C("g")
l = D("l")
b = A("b")
n = B("n")
f = C("f")
i = B("i")

a.y = b
a.r = b
e.v = l
e.t = a
g.t = f
g.w = f
g.y = f
l.s = i
l.z = f
b.y = a
b.r = a
n.v = l
n.t = b
f.t = g
f.w = g
f.y = g
i.v = l
i.t = a
assert n.t.r.r.y.r.y.y.txt == "b"