class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: B = None
        self.s: E = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
j = C("j")
c = D("c")
f = E("f")
d = F("d")
k = G("k")
e = G("e")
i = D("i")
h = C("h")

l.y = j
l.x = m
l.s = f
l.p = c
m.z = l
m.q = f
j.y = f
j.q = d
c.t = f
c.y = i
c.p = m
f.y = k
d.v = m
k.p = j
k.o = m
k.u = m
e.p = h
e.o = m
e.u = m
i.t = f
i.y = c
i.p = m
h.y = f
h.q = d
assert d.v.z.y.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: B = None
        self.s: E = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
j = C("j")
c = D("c")
f = E("f")
d = F("d")
k = G("k")
e = G("e")
i = D("i")
h = C("h")

l.y = j
l.x = m
l.s = f
l.p = c
m.z = l
m.q = f
j.y = f
j.q = d
c.t = f
c.y = i
c.p = m
f.y = k
d.v = m
k.p = j
k.o = m
k.u = m
e.p = h
e.o = m
e.u = m
i.t = f
i.y = c
i.p = m
h.y = f
h.q = d
assert d.v.z.y.q.v.q.txt == "f"