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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.v: G = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.y: E = None
        self.t: G = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

h.r = j
h.p = c
g.u = b
g.z = b
g.y = l
g.v = d
j.p = g
j.x = g
j.y = b
j.t = d
j.v = a
c.q = d
b.p = l
a.t = g
d.t = a
d.w = a
d.u = j
d.p = b
l.r = j
l.p = c
assert b.p.p.q.u.t.u.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.v: G = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.y: E = None
        self.t: G = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

h.r = j
h.p = c
g.u = b
g.z = b
g.y = l
g.v = d
j.p = g
j.x = g
j.y = b
j.t = d
j.v = a
c.q = d
b.p = l
a.t = g
d.t = a
d.w = a
d.u = j
d.p = b
l.r = j
l.p = c
assert b.p.p.q.u.t.u.v.t.txt == "g"