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

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

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

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

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

c.s = j
c.o = j
c.r = j
c.y = g
e.r = b
e.y = b
e.v = d
e.t = d
i.y = h
f.t = i
d.t = j
h.s = i
h.r = i
h.y = d
h.o = j
j.y = c
b.r = e
b.y = e
b.v = f
b.t = g
g.t = j
assert g.t.y.y.t.y.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: D = None
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

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

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

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

c.s = j
c.o = j
c.r = j
c.y = g
e.r = b
e.y = b
e.v = d
e.t = d
i.y = h
f.t = i
d.t = j
h.s = i
h.r = i
h.y = d
h.o = j
j.y = c
b.r = e
b.y = e
b.v = f
b.t = g
g.t = j
assert g.t.y.y.t.y.y.t.txt == "j"