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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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