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

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: B = None
        self.y: E = None
        self.z: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.u: E = None
        self.p: G = None
        self.r: C = None
        self.v: B = None
        self.x: B = None
        self.txt = txt

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

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

f.u = j
g.r = f
g.s = f
b.o = e
b.t = j
b.y = l
j.s = e
j.x = g
j.y = l
j.z = i
l.x = e
l.u = f
e.q = b
e.r = b
e.z = g
e.v = g
e.x = g
e.u = l
e.p = i
i.p = f
assert g.s.u.s.r.y.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: B = None
        self.y: E = None
        self.z: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.u: E = None
        self.p: G = None
        self.r: C = None
        self.v: B = None
        self.x: B = None
        self.txt = txt

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

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

f.u = j
g.r = f
g.s = f
b.o = e
b.t = j
b.y = l
j.s = e
j.x = g
j.y = l
j.z = i
l.x = e
l.u = f
e.q = b
e.r = b
e.z = g
e.v = g
e.x = g
e.u = l
e.p = i
i.p = f
assert g.s.u.s.r.y.u.u.txt == "j"