class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: F = None
        self.x: G = None
        self.q: E = None
        self.txt = txt

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

l.u = a
a.x = f
a.u = e
e.v = a
h.p = l
h.x = l
f.s = a
c.y = h
k.p = m
k.w = c
k.x = j
k.q = f
i.y = h
m.v = a
j.p = e
j.w = c
j.x = k
j.q = f
assert i.y.x.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: F = None
        self.x: G = None
        self.q: E = None
        self.txt = txt

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

l.u = a
a.x = f
a.u = e
e.v = a
h.p = l
h.x = l
f.s = a
c.y = h
k.p = m
k.w = c
k.x = j
k.q = f
i.y = h
m.v = a
j.p = e
j.w = c
j.x = k
j.q = f
assert i.y.x.u.u.txt == "e"