class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

l.o = h
l.u = a
d.w = m
d.u = m
d.o = e
d.v = e
m.s = d
m.v = a
a.q = d
h.r = m
c.y = j
c.p = e
e.x = j
j.y = c
j.p = e
assert h.r.v.q.v.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

l.o = h
l.u = a
d.w = m
d.u = m
d.o = e
d.v = e
m.s = d
m.v = a
a.q = d
h.r = m
c.y = j
c.p = e
e.x = j
j.y = c
j.p = e
assert h.r.v.q.v.x.y.txt == "c"