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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.t: A = None
        self.x: C = None
        self.q: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: B = None
        self.q: A = None
        self.x: D = None
        self.v: D = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
f = C("f")
c = D("c")
g = E("g")
e = F("e")
l = G("l")
i = D("i")

a.x = f
a.p = e
d.u = f
d.x = f
d.y = g
d.t = a
d.q = e
f.u = c
c.x = f
g.t = l
g.r = d
g.q = a
g.x = i
g.v = i
e.r = f
l.x = g
i.x = f
assert g.v.x.u.x.u.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.t: A = None
        self.x: C = None
        self.q: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: B = None
        self.q: A = None
        self.x: D = None
        self.v: D = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
f = C("f")
c = D("c")
g = E("g")
e = F("e")
l = G("l")
i = D("i")

a.x = f
a.p = e
d.u = f
d.x = f
d.y = g
d.t = a
d.q = e
f.u = c
c.x = f
g.t = l
g.r = d
g.q = a
g.x = i
g.v = i
e.r = f
l.x = g
i.x = f
assert g.v.x.u.x.u.x.u.x.txt == "f"