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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: E = None
        self.x: F = None
        self.o: D = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: F = None
        self.p: B = None
        self.q: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.z: B = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: E = None
        self.x: F = None
        self.o: D = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: F = None
        self.p: B = None
        self.q: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.z: B = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

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

f.r = e
h.y = c
h.r = d
e.s = d
e.o = d
e.v = j
e.x = c
e.t = f
d.r = g
d.x = g
d.z = j
d.p = h
d.q = l
j.y = f
j.q = f
j.w = c
j.p = h
l.x = f
l.u = g
l.t = g
l.z = c
g.r = j
g.s = j
g.w = j
g.z = h
g.o = h
c.x = f
c.u = g
c.t = g
c.z = l
assert f.r.v.p.r.p.txt == "h"